<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>八字排盘</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "Microsoft YaHei", "SimHei", sans-serif;
        }
        
        body {
            background: #f5e8d3 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect fill-opacity="0.05" fill="%23000" width="100" height="100"/></svg>');
            color: #333;
            padding: 20px;
            line-height: 1.6;
        }
        
        .container {
            max-width: 1100px;
            margin: 0 auto;
            background: #fff;
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            border: 1px solid #d4b16a;
        }
        
        header {
            background: linear-gradient(to right, #8b0000, #a52a2a);
            color: #fff;
            padding: 20px;
            text-align: center;
            border-bottom: 5px solid #d4b16a;
            position: relative;
        }
        
        h1 {
            font-size: 28px;
            margin-bottom: 10px;
            text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.3);
        }
        
        .subtitle {
            font-size: 16px;
            opacity: 0.9;
        }
        
        .main-content {
            display: flex;
            flex-wrap: wrap;
            padding: 20px;
        }
        
        .input-section {
            flex: 1;
            min-width: 320px;
            padding: 20px;
            background: #f9f3e9;
            border-radius: 8px;
            margin-right: 20px;
            border: 1px solid #e0d5c0;
        }
        
        .result-section {
            flex: 2;
            min-width: 400px;
            padding: 20px;
            background: #fff;
            border-radius: 8px;
            border: 1px solid #e0d5c0;
        }
        
        .form-group {
            margin-bottom: 15px;
        }
        
        label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
            color: #5c3317;
        }
        
        input, select {
            width: 100%;
            padding: 10px;
            border: 1px solid #d4b16a;
            border-radius: 4px;
            background: #fffaf0;
            font-size: 16px;
        }
        
        .radio-group {
            display: flex;
            gap: 15px;
        }
        
        .radio-option {
            display: flex;
            align-items: center;
        }
        
        .radio-option input {
            width: auto;
            margin-right: 5px;
        }
        
        button {
            width: 100%;
            padding: 12px;
            background: linear-gradient(to bottom, #8b0000, #a52a2a);
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            margin-top: 10px;
            transition: all 0.3s;
            position: relative;
        }
        
        button:hover {
            background: linear-gradient(to bottom, #a52a2a, #8b0000);
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }
        
        button:disabled {
            background: #cccccc;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }
        
        .loading-spinner {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255,255,255,.3);
            border-radius: 50%;
            border-top-color: #fff;
            animation: spin 1s ease-in-out infinite;
            margin-right: 10px;
        }
        
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
        
        .datetime-inputs {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }
        
        .date-input, .time-input {
            position: relative;
        }
        
        .date-input::after, .time-input::after {
            content: "📅";
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            pointer-events: none;
        }
        
        .time-input::after {
            content: "⏰";
        }
        
        .result-box {
            margin-top: 20px;
        }
        
        .result-header {
            background: #8b0000;
            color: white;
            padding: 10px;
            text-align: center;
            border-radius: 4px 4px 0 0;
            margin-bottom: 15px;
        }
        
        .bazi-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 10px;
            margin-bottom: 20px;
        }
        
        .bazi-column {
            text-align: center;
            padding: 15px;
            background: #f9f3e9;
            border-radius: 8px;
            border: 1px solid #d4b16a;
            position: relative;
        }
        
        .bazi-title {
            font-weight: bold;
            color: #8b0000;
            margin-bottom: 10px;
            border-bottom: 1px solid #d4b16a;
            padding-bottom: 5px;
        }
        
        .bazi-content {
            font-size: 20px;
            font-weight: bold;
            color: #5c3317;
            margin-bottom: 5px;
        }
        
        .bazi-detail {
            font-size: 14px;
            color: #8b0000;
        }
        
        .wuxing {
            position: absolute;
            bottom: 5px;
            right: 5px;
            font-size: 12px;
            color: #8b0000;
            background: #f9f3e9;
            padding: 2px 5px;
            border-radius: 3px;
        }
        
        .dayun-list, .liunian-list {
            margin-top: 15px;
        }
        
        .list-title {
            font-weight: bold;
            color: #8b0000;
            margin-bottom: 10px;
            border-bottom: 1px solid #d4b16a;
            padding-bottom: 5px;
        }
        
        .list-item {
            padding: 8px;
            border-bottom: 1px dashed #d4b16a;
            display: flex;
            justify-content: space-between;
        }
        
        .list-item:last-child {
            border-bottom: none;
        }
        
        .list-detail {
            font-size: 12px;
            color: #8b0000;
        }
        
        .result-text {
            margin-top: 20px;
            padding: 15px;
            background: #f9f3e9;
            border-radius: 8px;
            border: 1px solid #d4b16a;
            line-height: 1.8;
            white-space: pre-wrap;
        }
        
        footer {
            text-align: center;
            padding: 20px;
            color: #666;
            font-size: 14px;
            border-top: 1px solid #e0d5c0;
            background: #f9f3e9;
        }
        
        .note {
            background: #fffaf0;
            padding: 10px;
            border-radius: 4px;
            border-left: 4px solid #d4b16a;
            margin-top: 15px;
            font-size: 14px;
        }
        
        .additional-info {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-top: 20px;
            margin-bottom: 1em;
        }
        
        .info-box {
            padding: 10px;
            background: #f9f3e9;
            border-radius: 8px;
            border: 1px solid #d4b16a;
        }
        
        .info-title {
            font-weight: bold;
            color: #8b0000;
            margin-bottom: 5px;
        }
        
        .error-message {
            color: #d9534f;
            padding: 10px;
            background: #f8d7da;
            border-radius: 4px;
            margin-top: 10px;
            display: none;
        }
        
        @media (max-width: 768px) {
            .main-content {
                flex-direction: column;
            }
            
            .input-section {
                margin-right: 0;
                margin-bottom: 20px;
            }
            
            .bazi-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            
            .additional-info {
                grid-template-columns: 1fr;
            }
            
            .datetime-inputs {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1>八字排盘</h1>
            <div class="subtitle">AI八字分析辅助工具，提供八字信息总结文本</div>
        </header>
        
        <div class="main-content">
            <div class="input-section">
                <h2>生辰信息</h2>
                <div class="form-group">
                    <label>日历类型</label>
                    <div class="radio-group">
                        <div class="radio-option">
                            <input type="radio" id="solar" name="calendarType" value="公历" checked>
                            <label for="solar">公历</label>
                        </div>
                        <div class="radio-option">
                            <input type="radio" id="lunar" name="calendarType" value="农历">
                            <label for="lunar">农历</label>
                        </div>
                    </div>
                </div>
                
                <div class="form-group">
                    <label>出生日期</label>
                    <div class="datetime-inputs">
                        <div class="date-input">
                            <input type="text" id="datePicker" placeholder="选择日期" readonly>
                        </div>
                        <div class="time-input">
                            <input type="text" id="timePicker" placeholder="选择时间" readonly>
                        </div>
                    </div>
                    <input type="hidden" id="year">
                    <input type="hidden" id="month">
                    <input type="hidden" id="day">
                    <input type="hidden" id="hour">
                    <input type="hidden" id="minute">
                    <input type="hidden" id="second" value="0">
                </div>
                
                <div class="form-group">
                    <label>性别</label>
                    <div class="radio-group">
                        <div class="radio-option">
                            <input type="radio" id="male" name="gender" value="男" checked>
                            <label for="male">男</label>
                        </div>
                        <div class="radio-option">
                            <input type="radio" id="female" name="gender" value="女">
                            <label for="female">女</label>
                        </div>
                    </div>
                </div>
                
                <div class="form-group">
                    <label>排盘流派</label>
                    <div class="radio-group">
                        <div class="radio-option">
                            <input type="radio" id="sect1" name="sect" value="1">
                            <label for="sect1">流派一</label>
                        </div>
                        <div class="radio-option">
                            <input type="radio" id="sect2" name="sect" value="2" checked>
                            <label for="sect2">流派二（默认）</label>
                        </div>
                    </div>
                    <div class="note">
                        流派一：晚子时日柱算明天<br>
                        流派二：晚子时日柱算当天<br>
                        两种流派都认为晚子时时柱算明天
                    </div>
                </div>
                
                <div class="form-group">
                    <label>是否显示小运</label>
                    <div class="radio-group">
                        <div class="radio-option">
                            <input type="radio" id="showXiaoyun" name="showXiaoyun" value="true" checked>
                            <label for="showXiaoyun">显示</label>
                        </div>
                        <div class="radio-option">
                            <input type="radio" id="hideXiaoyun" name="showXiaoyun" value="false">
                            <label for="hideXiaoyun">不显示</label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label>是否显示流年</label>
                    <div class="radio-group">
                        <div class="radio-option">
                            <input type="radio" id="showYear" name="showYear" value="true" checked>
                            <label for="showYear">显示</label>
                        </div>
                        <div class="radio-option">
                            <input type="radio" id="hideYear" name="showYear" value="false">
                            <label for="hideYear">不显示</label>
                        </div>
                    </div>
                </div>
                
                <div class="error-message" id="errorMessage"></div>
                
                <button id="calculateBtn">
                    <span id="buttonText">开始排盘</span>
                    <span class="loading-spinner" id="loadingSpinner" style="display: none;"></span>
                </button>
            </div>
            
            <div class="result-section">
                <h2>排盘结果</h2>
                <div class="result-box">
                    <div class="result-header">四柱八字</div>
                    <div class="bazi-grid">
                        <div class="bazi-column">
                            <div class="bazi-title">年柱</div>
                            <div class="bazi-content" id="yearPillar">--</div>
                            <div class="bazi-detail" id="yearDetail">--</div>
                            <div class="wuxing" id="yearWuxing">--</div>
                        </div>
                        <div class="bazi-column">
                            <div class="bazi-title">月柱</div>
                            <div class="bazi-content" id="monthPillar">--</div>
                            <div class="bazi-detail" id="monthDetail">--</div>
                            <div class="wuxing" id="monthWuxing">--</div>
                        </div>
                        <div class="bazi-column">
                            <div class="bazi-title">日柱</div>
                            <div class="bazi-content" id="dayPillar">--</div>
                            <div class="bazi-detail" id="dayDetail">--</div>
                            <div class="wuxing" id="dayWuxing">--</div>
                        </div>
                        <div class="bazi-column">
                            <div class="bazi-title">时柱</div>
                            <div class="bazi-content" id="hourPillar">--</div>
                            <div class="bazi-detail" id="hourDetail">--</div>
                            <div class="wuxing" id="hourWuxing">--</div>
                        </div>
                    </div>
                    
                    <div class="additional-info">
                        <div class="info-box">
                            <div class="info-title">命主（日主）</div>
                            <div id="mingzhu">--</div>
                        </div>
                    </div>
                    
                    <div class="result-header">起运信息</div>
                    <div id="qiyunInfo">--</div>
                    
                    <div class="dayun-list">
                        <div class="list-title">大运列表</div>
                        <div id="dayunList">
                            <div class="list-item"><span>--</span><span>--</span></div>
                        </div>
                    </div>
                    
                    <div class="liunian-list">
                        <div class="list-title">流年列表</div>
                        <div id="liunianList">
                            <div class="list-item"><span>--</span><span>--</span></div>
                        </div>
                    </div>
                    
                    <div>
                        <button id="copyTextButton">复制文本</button>
                    </div>
                    <pre class="result-text" id="resultText">
请填写生辰信息后点击"开始排盘"按钮
                    </pre>
                </div>
            </div>
        </div>
        
        <footer>
            <p>© 2025 cyue.net | 本工具仅供参考，不作为实际命理推断依据</p>
        </footer>
    </div>

</body>
</html>

